package com.singzi.leetcode.N1800;

public class T1716 {
    public static void main(String[] args) {
        Solution1716 solution1716 = new Solution1716();
        System.out.println(solution1716.totalMoney(20));
    }
}
class Solution1716 {
    public int totalMoney(int n) {
        int result = 0;
        int rounds = n/7;
        int remain = n%7;
        for (int i = 0; i < rounds; i++) {
            result += 28+i*7;
        }
        for (int i = 0; i < remain; i++) {
            result += i + rounds+1;
        }
        return result;
    }
}